package com.pp.controller;

import com.pp.common.pojo.Admin;
import com.pp.common.vo.SysResult;
import com.pp.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/manage")
public class AdminController {

    @Autowired
    private AdminService adminService;

    @PostMapping("/login")
    public SysResult login(@RequestBody Admin admin){
        String token = adminService.login(admin);
        if (StringUtils.hasLength(token)){
            return SysResult.success(token);
        }
        return SysResult.fail();
    }


}
